﻿<UserControl
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
	xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
	xmlns:local="clr-namespace:EIA.SLClient.ProjectManage.Members"
	xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity" 
	xmlns:ei="http://schemas.microsoft.com/expression/2010/interactions"
	xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk" 
	xmlns:EIA_SLClient_Utility="clr-namespace:EIA.SLClient.Utility;assembly=EIA.SLClient.Utility"
	xmlns:EIA_SLClient_Utility_Behaviors="clr-namespace:EIA.SLClient.Utility.Behaviors;assembly=EIA.SLClient.Utility"
	xmlns:toolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit"
	mc:Ignorable="d"
	x:Class="EIA.SLClient.ProjectManage.Members.MembersView"
	d:DesignWidth="640" d:DesignHeight="480">
	<UserControl.Resources>
		<local:MembersViewModel x:Key="MembersViewModelDataSource" />
		<DataTemplate x:Key="OptDataTemplate">
        	<StackPanel d:DesignWidth="100" Orientation="Horizontal">
                <HyperlinkButton Content="编辑" CommandParameter="{Binding}" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="8,0" BorderThickness="0">
                    <EIA_SLClient_Utility:BindingHelper.AncestorBinding>
                        <EIA_SLClient_Utility:AncestorBinding TargetPath="Command" AncestorPath="DataContext.UpdateItemCommand" AncestorTypeName="DataGrid"/>
                    </EIA_SLClient_Utility:BindingHelper.AncestorBinding>
                </HyperlinkButton>
                <HyperlinkButton Content="删除" CommandParameter="{Binding}" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="8,0">
                    <EIA_SLClient_Utility:BindingHelper.AncestorBinding>
                        <EIA_SLClient_Utility:AncestorBinding TargetPath="Command" AncestorPath="DataContext.DeleteItemCommand" AncestorTypeName="DataGrid"/>
                    </EIA_SLClient_Utility:BindingHelper.AncestorBinding>
                </HyperlinkButton>
            </StackPanel>
		</DataTemplate>
	</UserControl.Resources>

	<Grid x:Name="LayoutRoot" DataContext="{Binding Source={StaticResource MembersViewModelDataSource}}">
		<i:Interaction.Triggers>
			<i:EventTrigger>
				<ei:CallMethodAction TargetObject="{Binding Mode=OneWay}" MethodName="OnLoad"/>
			</i:EventTrigger>
		</i:Interaction.Triggers>
		
		<Grid d:LayoutOverrides="GridBox" HorizontalAlignment="Center">
			<Grid.RowDefinitions>
				<RowDefinition/>
				<RowDefinition Height="70"/>
			</Grid.RowDefinitions>
			<Grid.ColumnDefinitions>
				<ColumnDefinition/>
			</Grid.ColumnDefinitions>
			<sdk:DataGrid BorderThickness="1" BorderBrush="#FFDADBDB" IsReadOnly="True" Margin="0,8" ItemsSource="{Binding MemberCollection}" HorizontalAlignment="Center" Width="480">
				<sdk:DataGrid.Columns>
					<sdk:DataGridTextColumn Binding="{Binding StfId}" Header="编号"/>
					<sdk:DataGridTextColumn Binding="{Binding StfName}" Header="姓名" MinWidth="120"/>
					<sdk:DataGridTextColumn Binding="{Binding WorkRate, StringFormat=P}" Header="工作量" />
					<sdk:DataGridTemplateColumn Header="操作" CellTemplate="{StaticResource OptDataTemplate}"/>
				</sdk:DataGrid.Columns>
			</sdk:DataGrid>
			<Path Data="M80,410 L400,410" Height="1" Grid.Row="1" Stretch="Fill" Stroke="#FFD8D9D9" UseLayoutRounding="False" VerticalAlignment="Top" HorizontalAlignment="Center" Width="480"/>
			<Button Content="添加" Command="{Binding InsertItemCommand}" BorderThickness="0" Padding="0" Style="{StaticResource bs_clear}" Margin="0,16,8,0" FontSize="14.667" HorizontalAlignment="Right" Width="120" Foreground="White" Grid.Row="1" Height="30" VerticalAlignment="Top">
				<Button.Background>
					<ImageBrush Stretch="Fill" ImageSource="/EIA.SLClient.ProjectManage;component/assets/img/btn2-1.png"/>
				</Button.Background>
				<i:Interaction.Behaviors>
					<EIA_SLClient_Utility_Behaviors:Background4StateBehavior>
						<EIA_SLClient_Utility_Behaviors:Background4StateBehavior.BackgroundPressed>
							<ImageBrush Stretch="Fill" ImageSource="/EIA.SLClient.ProjectManage;component/assets/img/btn2-2.png"/>
						</EIA_SLClient_Utility_Behaviors:Background4StateBehavior.BackgroundPressed>
						<EIA_SLClient_Utility_Behaviors:Background4StateBehavior.BackgroundNormal>
							<ImageBrush Stretch="Fill" ImageSource="/EIA.SLClient.ProjectManage;component/assets/img/btn2-1.png"/>
						</EIA_SLClient_Utility_Behaviors:Background4StateBehavior.BackgroundNormal>
						<EIA_SLClient_Utility_Behaviors:Background4StateBehavior.BackgroundMouseOver>
							<ImageBrush Stretch="Fill" ImageSource="/EIA.SLClient.ProjectManage;component/assets/img/btn2-2.png"/>
						</EIA_SLClient_Utility_Behaviors:Background4StateBehavior.BackgroundMouseOver>
						<EIA_SLClient_Utility_Behaviors:Background4StateBehavior.BackgroundDisabled>
							<ImageBrush Stretch="Fill" ImageSource="/EIA.SLClient.ProjectManage;component/assets/img/btn2-1.png" Opacity="0.4"/>
						</EIA_SLClient_Utility_Behaviors:Background4StateBehavior.BackgroundDisabled>
					</EIA_SLClient_Utility_Behaviors:Background4StateBehavior>
				</i:Interaction.Behaviors>
			</Button>
		</Grid>
		<local:MemberEditView d:IsHidden="True"/>
	</Grid>
</UserControl>
